﻿using System;

namespace Outfish.JavaScript {

	/// <summary>Stores text, location, length, and type of a Javascript token</summary>
	public class JsToken {
	
		public JsToken( string host, int begin, int end, JsTokenType type ){
			this.Text = host.Substring(begin, end-begin);
			this.Begin = begin;
			this.Type = type;
		}
		
		public string Text { get; set; }
		
		public int Begin { get; set; }
		
		/// <summary>Index just after the last character. (beginning of next item)</summary>
		public int End {get { return this.Begin + this.Text.Length; }}
		
		public JsTokenType Type { get; set; }
	}
	
}
